package com.ruoyi.movie.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.movie.domain.MovieMonthVisits;
import com.ruoyi.movie.service.IMovieMonthVisitsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 电影月访问统计Controller
 *
 * @author ruoyi
 * @date 2025-01-29
 */
@RestController
@RequestMapping("/movie/monthVisits")
public class MovieMonthVisitsController extends BaseController
{
    @Autowired
    private IMovieMonthVisitsService movieMonthVisitsService;

    /**
     * 查询电影月访问统计列表
     */
    @PreAuthorize("@ss.hasPermi('movie:monthVisits:list')")
    @GetMapping("/list")
    public TableDataInfo list(MovieMonthVisits movieMonthVisits)
    {
        startPage();
        List<MovieMonthVisits> list = movieMonthVisitsService.selectMovieMonthVisitsList(movieMonthVisits);
        return getDataTable(list);
    }

    /**
     * 导出电影月访问统计列表
     */
    @PreAuthorize("@ss.hasPermi('movie:monthVisits:export')")
    @Log(title = "电影月访问统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MovieMonthVisits movieMonthVisits)
    {
        List<MovieMonthVisits> list = movieMonthVisitsService.selectMovieMonthVisitsList(movieMonthVisits);
        ExcelUtil<MovieMonthVisits> util = new ExcelUtil<MovieMonthVisits>(MovieMonthVisits.class);
        util.exportExcel(response, list, "电影月访问统计数据");
    }

    /**
     * 获取电影月访问统计详细信息
     */
    @PreAuthorize("@ss.hasPermi('movie:monthVisits:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(movieMonthVisitsService.selectMovieMonthVisitsById(id));
    }
}
